Repository navigation
DietPi-CloudShell: Add Pi-hole v6 REST API support for the Pi-hole scene - #8456
Conversation
Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
Co-authored-by: MichaIng <28480705+MichaIng@users.noreply.github.com>
cb2d5a5 to
61cd45d
Compare
61cd45d to
e9dc6a8
Compare
|
Post-merge review + live test Test setup: NanoPi Zero2 (DietPi on Trixie), Pi-hole FTL v6.8 installed via The stats values (ads blocked, queries, blocked domains, percentage) are correct, and session reuse works, also across an FTL restart. Three issues, though: 1. Last blocked domain is always empty Pihole_Request 'stats/recent_blocked?count=1' || return 1
PIHOLE_LAST_DOMAIN_BLOCKED=$(sed -n 's/.*"blocked":\["\([^"]*\)".*/\1/p' <<< "$PIHOLE_RESPONSE")2. Cached password goes stale after an FTL restart 3. Creating Minor
I can open a follow-up PR for 1-3 if you like. |
|
All addressed in #8463.
Another point I wanted to check is whether the |
Pi-hole v6 removed the FTL TCP socket API, so the Pi-hole scene only showed "Pi-hole v6 not supported yet". This change fetches the same stats from the new HTTP REST API, authenticating with
/etc/pihole/cli_pw.API access (v6 path in
Obtain_PIHOLE)/etc/pihole/pihole.tomland takes the web port from itsportentry, defaulting to 80.POST /api/authusing thecli_pwpassword, then readsGET /api/stats/summary. This gives total queries, blocked queries and blocked domains, and the percentage is computed as before./api/queries?length=1&upstream=blocked, then closes the session withDELETE /api/auth.sed, so there is nojqdependency.cli_pwhandling (newPihole_CLI_Password)pihole) and prints a notice.sudofallback, so non-root runs need the file created by a root run first.Review notes
cli_pwourselves, or whether it expects to generate the file. If login fails after we create the file, that is the first thing to check.